//author:jxx
//此处是对表单的方法，组件，权限操作按钮等进行任意扩展(方法扩展可参照SellOrder.js)
let extension = {
    components: {//动态扩充组件或组件路径
        //表单header、content、footer对应位置扩充的组件
        gridHeader: '',//{ template: "<div>扩展组xx件</div>" },
        gridBody: '',
        gridFooter: '',
        //弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件
        modelHeader: '',
        modelBody: '',
        modelFooter: ''
    },
    buttons: { view: [], box: [], detail: [] },//扩展的按钮
    methods: {//事件扩展
        onInit () {

            this.boxOptions.labelWidth = 140
            this.boxOptions.width = 900

            this.columns.forEach(x => {
                if (x.field == "isAvailable") {
                    x.bind = {
                        key: "audit",
                        data: [
                            { key: 0, value: "否" },
                            { key: 1, value: "是" },
                        ]
                    }
                }
            })
            // 循环表单
            this.editFormOptions.forEach(x => {
                x.forEach(item => {
                    let field = item.field
                    if (field == "id" || field == "createDate" || field == "createID" || field == "creator" || field == "modifyDate" || field == "modifier" || field == "modifyID" || field == "typeName" || field == "typeCode" || field == "latitude") {
                        item.hidden = true
                    }
                    if (item.field == "Facilities_and_Features") {
                        item.type = "checkbox"
                        item.title = "设施与功能"
                        item.data = [
                            { "key": 1, "value": "无烟房" },
                            { "key": 2, "value": "WiFi" },
                            { "key": 3, "value": "电话" },
                            { "key": 4, "value": "迷你吧" },
                            { "key": 5, "value": "送餐" }
                        ]
                    }
                    if (item.field == "imageAddress") {
                        item.multiple = true
                        item.maxFile = 3
                    }
                });
            })
        },
        rowClick ({ row, column, event }) { //查询界面table点击行选中当前行
            this.$refs.table.$refs.table.toggleRowSelection(row);
            return true;
        },
        modelOpenAfter (row) {
            // row.Facilities_and_Features = row.Facilities_and_Features.split(',')
        }
    }
};
export default extension;